package com.xj.edu.hotel.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;

import javax.servlet.http.HttpSession;

@Controller
public class Common {
    @RequestMapping("/")
    public String toLogin(){
        return "login";
    }

    @RequestMapping("toRegister")
    public String toRegister(){
        return "register";
    }
    @RequestMapping("toUserLogin")
    public String toUserLogin(){
        return "index";
    }

    @RequestMapping("toRegist")
    public String toRegist(){
        return "regist";
    }

    @RequestMapping("toHotel")
    public String toHotel(){
        return "cityHotel";
    }

    @RequestMapping("toStarter")
    public String toStart(){
        return "starter";
    }

@RequestMapping("toEditUser")
public  String toEditUser(){
        return "editUser";
}
    @RequestMapping("toAddHotel")
    public String toAddHotel(){
        return "addHotelForm";
    }

    @RequestMapping("toHotelRoom")
    public String toHotelRoom(){
        return "hotelRoom";
    }
    @RequestMapping("toRooms")
    public  String toRooms(){ return "rooms"; }
    @RequestMapping("toGallery")
    public String toGallery(){
        return "gallery";
    }
    @RequestMapping("toDetail")
    public String toDetail(){
        return "detail";
    }
    @RequestMapping("toOrderinfo")
    public String toOrderinfo(){
        return "orderinfo";
    }

    @RequestMapping("toUserorder")
    public String toUserorder() {return "userorder";}
    @RequestMapping("toorderitem")
    public String toOrderitem() {return "orderitem";}

    @RequestMapping("toForget")
    public String toForgetPassword(){
        return "forget-password";
    }


    @RequestMapping("toSpecialHotel")
    public String toSpecialHotel(){
        return "specialHotel";
    }

    @RequestMapping("to403")
    public String to403(){
        return "/common/403";
    }
    @RequestMapping("toText")
    public String toText(){
        return "text";
    }
    @RequestMapping("toError")
    public String toError(){
        return "/common/500";
    }

    /**
     * 退出登录
     */
    @RequestMapping("/logout")
    public String logout(HttpSession session){
        Subject subject = SecurityUtils.getSubject();
        subject.logout();
        return "login";
    }

}
